package com.scut.scutzone.util;

import org.springframework.util.StringUtils;

/**
 * @author: lifeng Chan
 * @date: 2021/4/26 16:46
 * @description: 工具类
 */
public class SZUtil {


    static public String generateUUID(){
        return java.util.UUID.randomUUID().toString();
    }

    static public  boolean checkUserInfo(String username, String sex,String major,int grade,String description){
        //stub!
        return true;
    }

    static public boolean checkPassword(String passwd){
        return true;
    }

    static public String getRealImgsName(String[] imgs_name){
        String real_imgs_name = "[";
        for (String img:imgs_name) {
            String temp = "\"";
            temp = temp+img;
            temp = temp + "\",";
            real_imgs_name = real_imgs_name+temp;
        }
        if (imgs_name.length!=0) {
            real_imgs_name = real_imgs_name.substring(0, real_imgs_name.length() - 1);
        }
        real_imgs_name = real_imgs_name + "]";
        return real_imgs_name;
    }


    static public String[] parseRealImgsName(String real_imgs_name){
        if (real_imgs_name.length()>=2) {
            real_imgs_name = real_imgs_name.substring(1, real_imgs_name.length() - 1);
        }
        real_imgs_name = real_imgs_name.replaceAll("\"","");
        String[] imgs_name = real_imgs_name.split(",");
        if (imgs_name.length==1&&imgs_name[0].equals("")){
            return null;
        }
        return imgs_name;
    }
}
